from google.appengine.api import users
from base import BaseHandler

class SignInHandler(BaseHandler):
	def get(self):
		continue_url = self.request.get('continue')
		continue_url = '/' if continue_url == '' else continue_url
		openid_url = self.request.get('openid')
		openid_url = None if openid_url == '' else openid_url
		if not users.get_current_user() is None:
			self.redirect(continue_url)
		else:
			self.redirect(users.create_login_url(continue_url, None, openid_url))

class SignOutHandler(BaseHandler):
	def get(self):
		self.redirect(users.create_logout_url('/'))